package com.sxt.swing;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class HelloSwing {
	public static void main(String[] args) {
		JFrame frame = new JFrame("第一个Swing");
		JButton b1 = new JButton("按钮1");
		JButton b2 = new JButton("按钮2");
		JButton b3 = new JButton("按钮3");
		JButton b4 = new JButton("按钮4");
		JPanel panel = new JPanel();
		//JScrollPane spanel = new JScrollPane();
		
		BorderLayout bl = new BorderLayout();
		
		panel.setLayout(bl);
		panel.add(b1, BorderLayout.SOUTH);
		panel.add(b2, BorderLayout.NORTH);
		panel.add(b3, BorderLayout.WEST);
		panel.add(b4, BorderLayout.EAST);
		b4.setBounds(10, 10, 10, 10);
		/*
		 * spanel.add(b1); spanel.add(b2); spanel.add(b3); spanel.add(b4);
		 */
		//spanel.add(panel);
		

		// JDialog dialog = new JDialog();

		frame.setSize(500, 300);
		frame.setLocation(100, 100);
		frame.setVisible(true);
		frame.setResizable(false);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		frame.add(panel);
		//frame.setLayout(bl);
		
		// frame.getContentPane().add(b4);

		/*
		 * dialog.setSize(100, 100); dialog.setLocation(200,100);
		 * dialog.setVisible(true); frame.setResizable(false);
		 * dialog.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
		 */
	}

}
